"""myobject URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from myadmin.views import index
from myadmin.views import user, shop, category, product, member

urlpatterns = [
    path('', index.index, name="myadmin_index"),    # 后台首页

    # 后台管理员、登入退出
    path('login', index.login, name="myadmin_login"),    # 管理员登录表单
    path('dologin', index.dologin, name="myadmin_dologin"),    # 执行管理员登录
    path('logout', index.logout, name="myadmin_logout"),    # 管理员退出
    path('verify', index.verify, name="myadmin_verify"),  # 验证码

    # 员工信息管理
    path('user/<int:pIndex>', user.index, name="myadmin_user_index"),     # 浏览
    path('user/add', user.add, name="myadmin_user_add"),     # 添加表单
    path('user/insert', user.insert, name="myadmin_user_insert"),     # 执行添加
    path('user/del/<int:uid>', user.delete, name="myadmin_user_delete"),     # 执行删除
    path('user/edit/<int:uid>', user.edit, name="myadmin_user_edit"),     # 加载编辑表单
    path('user/update/<int:uid>', user.update, name="myadmin_user_update"),     # 执行编辑
    path('user/reset/<int:uid>', user.reset, name="myadmin_user_reset"),     # 重置员工密码

    # 店铺信息管理
    path('shop/<int:pIndex>', shop.index, name="myadmin_shop_index"),     # 浏览
    path('shop/add', shop.add, name="myadmin_shop_add"),     # 添加表单
    path('shop/insert', shop.insert, name="myadmin_shop_insert"),     # 执行添加
    path('shop/del/<int:uid>', shop.delete, name="myadmin_shop_delete"),     # 执行删除
    path('shop/edit/<int:uid>', shop.edit, name="myadmin_shop_edit"),     # 加载编辑表单
    path('shop/update/<int:uid>', shop.update, name="myadmin_shop_update"),     # 执行编辑

    # 菜品分类信息管理
    path('category/<int:pIndex>', category.index, name="myadmin_category_index"),     # 浏览
    path('category/load/<int:uid>', category.loadCategory, name="myadmin_category_load"),# 用于二级联动
    path('category/add', category.add, name="myadmin_category_add"),     # 添加表单
    path('category/insert', category.insert, name="myadmin_category_insert"),     # 执行添加
    path('category/del/<int:uid>', category.delete, name="myadmin_category_delete"),     # 执行删除
    path('category/edit/<int:uid>', category.edit, name="myadmin_category_edit"),     # 加载编辑表单
    path('category/update/<int:uid>', category.update, name="myadmin_category_update"),     # 执行编辑


    # 菜品信息管理
    path('product/<int:pIndex>', product.index, name="myadmin_product_index"),  # 浏览
    path('product/add', product.add, name="myadmin_product_add"),  # 添加表单
    path('product/insert', product.insert, name="myadmin_product_insert"),  # 执行添加
    path('product/del/<int:uid>', product.delete, name="myadmin_product_delete"),  # 执行删除
    path('product/edit/<int:uid>', product.edit, name="myadmin_product_edit"),  # 加载编辑表单
    path('product/update/<int:uid>', product.update, name="myadmin_product_update"),  # 执行编辑

    # 会员信息模型
    path('member/<int:pIndex>', member.index, name="myadmin_member_index"),  # 浏览
    path('member/del/<int:uid>', member.delete, name="myadmin_member_delete"),     # 执行删除

]
